package com.wicket.okrframework.biz.service.impl;

import com.wicket.okrframework.base.service.MUsersService;
import com.wicket.okrframework.biz.service.dto.req.UpdateChangePasswordReqDto;
import com.wicket.okrframework.biz.service.dto.res.UpdateChangePasswordRespDto;
import com.wicket.okrframework.common.util.RedisUtil;
import com.wicket.okrframework.dal.po.mbg.Users;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import com.wicket.okrframework.common.exception.Assert;
import com.wicket.okrframework.biz.service.dto.res.ChangePasswordComRespDto;
import com.wicket.okrframework.biz.service.dto.req.ChangePasswordComReqDto;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@Service
public class PasswordServiceImpl
        implements com.wicket.okrframework.biz.service.PasswordService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    private MUsersService mUsersService;

    /**
   * D1-2修改密码[1158]
   * gen by moon at 8/10/2022, 3:14:46 AM
   */
  @Trace(operationName = "D1-2修改密码")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public UpdateChangePasswordRespDto updateChangePassword(UpdateChangePasswordReqDto reqDto){
    
      
      //步骤0: 1-2-01修改个人账号 - updateUser
     boolean bOOLEAN ;
    Users users=new Users();
  if(reqDto!=null){
      users.setUserId(reqDto.getUserId());//sourceId:24935_1
users.setPassword(reqDto.getPassword());//sourceId:24937_1
users.setPhone(reqDto.getPhone());//sourceId:27003_1
    }
  
    /*1-2-01修改个人账号[46]   */
    Assert.isNull(users.getUserId(),"D1-2修改密码-1-2-01修改个人账号-个人账号不能为空",false);
      bOOLEAN = mUsersService.updateUser(users);
      
      
    
UpdateChangePasswordRespDto retData = new UpdateChangePasswordRespDto();
  
  

  
  
return retData;
  }
/**
   * D1-2修改密码(公共)[1158]
   * gen by moon at 10/1/2022, 11:59:39 PM
   */
  @Trace(operationName = "D1-2修改密码(公共)")
  @Tags({@Tag(key = "参数",value = "arg[0]"),
            @Tag(key = "返回值",value = "returnedObj")})
  @Transactional(rollbackFor=Exception.class)
  @Override
  public ChangePasswordComRespDto changePasswordCom(ChangePasswordComReqDto reqDto){
    
      
      //步骤0: 1-2-01修改个人账号 - updateUser
     boolean bOOLEAN ;
    Users users=new Users();
  if(reqDto!=null){
      users.setUserId(reqDto.getUserId());//SimpleFieldAssign//sourceId:24935_1
users.setPassword(reqDto.getPassword());//SimpleFieldAssign//sourceId:24937_1
users.setPhone(reqDto.getPhone());//SimpleFieldAssign//sourceId:27003_1
    }
  
    /*1-2-01修改个人账号[46]   */
    Assert.isNull(users.getUserId(),"D1-2修改密码(公共)-1-2-01修改个人账号-个人账号不能为空",false);
      bOOLEAN = mUsersService.updateUser(users);
      
      
      
    
ChangePasswordComRespDto retData = new ChangePasswordComRespDto();
  
  

  
  
return retData;
  }
    //
}
